import 'package:dio/dio.dart';

import 'DioManager.dart';

class ApiService {
  final Dio _dio = DioManager().dio;

  Future<Response> get(String url, {Map<String, dynamic>? params}) async {
    try {
      Response response = await _dio.get(url, queryParameters: params);
      return response;
    } on DioException catch (e) {
      print('GET request error: $e');
      throw e;
    }
  }
  Future<Response> post(String url, {Map<String, dynamic>? data}) async {
    try {
      Response response = await _dio.post(url, data: data);
      return response;
    } on DioException catch (e) {
      print('POST request error: $e');
      throw e;
    }
  }
}
